<script setup lang="ts">
import {computed, reactive, ref} from 'vue'
import {useRouter} from "vue-router";

const router = useRouter()

const router_list = reactive([
  [{name: 'china'}],
  [{name: 'india'}],
  [{name: 'italy'}],
]);

const china = ref(0);
const index_string = computed(() => {
  return china.value.toString();
});
const to = (obj: any) => {
  router.push({
    name: obj.name,
  });
}
</script>

<template>
  <div id="top-header">
    <!-- 头部左侧 -->
    <dv-decoration-8 class="header-left-decoration" />
    <!-- 头部标题装饰 -->
    <dv-decoration-5 class="header-center-decoration" />
    <!-- 头部右侧 -->
    <dv-decoration-8 :reverse="true" class="header-right-decoration" />
    <!-- 头部标题 -->
    <div class="header-left-buttons">
      <button @click="to(router_list[0][0])">中国数据</button>
      <button @click="to(router_list[1][0])">印度数据</button>
      <button @click="to(router_list[2][0])">意大利数据</button>
    </div>
    <div class="center-title">空气污染大数据可视化</div>
  </div>
</template>

<style scoped lang="scss">
#top-header{
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;

  .header-center-decoration {
    width: 40%;
    height: 100%;
    margin-top: 15px;
  }
  .header-left-decoration,.header-right-decoration{
    width: 25%;
    height: 100%;
  }
  .center-title{
    position: absolute;
    font-size: 30px;
    font-weight: bold;
    left: 50%;
    top: 5%;
    transform: translate(-50%, -50%);
  }
  .header-left-buttons {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-right: 20px;
  }
}
</style>